<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGroupPolicyRulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('group_policy_rules', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->primary();
            $table->string('name',255)->default('')->comment('规则名称');
            $table->enum('cate',['DISTRIBUTOR','MERCHANT','STAFF'])->default('DISTRIBUTOR')->comment('分成分组');
            $table->unsignedBigInteger('group_policy_id')->default(0)->comment('策略id');
            $table->integer('scale')->default(0)->comment('分成比例 按10000计');
            $table->integer('sort')->default(0)->comment('排序');
            $table->timestamps();
            $table->softDeletes();
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('group_policy_rules');
    }
}
